/*
 * Created on 29.11.2003
 */
package de.javakicker;

import java.awt.Point;
import java.util.Collection;
import java.io.IOException;

import de.javakicker.GameEngine.RuntimePlayerImpl;

/**
 * The Interface GameRecorder.
 *
 * @author Till Krullmann
 */
public interface GameRecorder
{
	
	/** The Constant GOAL1_EVENT. */
	public static final String GOAL1_EVENT = "goal1";
	
	/** The Constant GOAL2_EVENT. */
	public static final String GOAL2_EVENT = "goal2";
	
	/** The Constant FOUL_EVENT. */
	public static final String FOUL_EVENT = "foul";
	
	/** The Constant YELLOWCARD_EVENT. */
	public static final String YELLOWCARD_EVENT = "yellow";
	
	/** The Constant REDCARD_EVENT. */
	public static final String REDCARD_EVENT = "red";
	
	/** The Constant HALFTIME_EVENT. */
	public static final String HALFTIME_EVENT = "halftime";

	/**
	 * Write teams.
	 *
	 * @param teams the teams
	 * @param allPlayers the players
	 * @throws IOException Signals that an I/O exception has occurred.
	 */
	void writeTeams(Team[] teams, Collection<RuntimePlayerImpl> allPlayers, String[] jerseys)
		throws IOException;

	/**
	 * Schreibt die Positionen der Spiel-Elemente (Spieler und Ball), nachdem
	 * sie manuell gesetzt wurden.
	 *
	 * @param allPlayers Eine Collection aus <code>RuntimePlayer</code>s
	 * @throws IOException Signals that an I/O exception has occurred.
	 */
	void writeResetPositions(Collection<RuntimePlayerImpl> allPlayers)
		throws IOException;

	/**
	 * Schreitet eine Minute in der Spielzeit voran.
	 *
	 * @throws IOException Signals that an I/O exception has occurred.
	 */
	void nextMinute()
		throws IOException;
	
	/**
	 * Zeichnet eine Spiel-Aktion auf.
	 *
	 * @param player Der Spieler, der die Aktion ausfuehrt
	 * @param action Die Konstante fuer die Aktion (in der {@link Player} Klasse
	 * definiert)
	 * @param target Die Position, auf die sich die Aktion auswirkt. Diese muss
	 * je nach Aktion unterschiedlich interpretiert werden.
	 * @param direction the direction
	 * @param pushedPlayerId the pushed player id
	 * @throws IOException Signals that an I/O exception has occurred.
	 */
	void writeAction(RuntimePlayerImpl player, String action, Point target, int direction, String pushedPlayerId, int goal, boolean foul)
		throws IOException;
		
	/**
	 * Write comment.
	 *
	 * @param text the text
	 * @throws IOException Signals that an I/O exception has occurred.
	 */
	void writeComment(String text)
		throws IOException;

	/**
	 * Close.
	 *
	 * @throws IOException Signals that an I/O exception has occurred.
	 */
	void close()
		throws IOException;
}